//
//  ViewController.m
//  目标动作回调
//
//  Created by clz on 2019/7/21.
//  Copyright © 2019年 clz. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //目标动作回调
    //目标就是接受事件反馈的对象
    
    //动作：事件反馈所要触发的方法
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    button.frame = CGRectMake(0, 100, 100, 100);
    [self.view addSubview:button];
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"按钮" forState:UIControlStateNormal];
}

- (void)click{
    NSLog(@"我被触发了");
}


@end
